﻿// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// -----------------------------------------------------------------------
using System;
using System.Reflection;
using Microsoft.Internal;

namespace System.ComponentModel.Composition.ReflectionModel
{
    internal abstract class ReflectionMember : ReflectionItem
    {
        private readonly MemberInfo _member;

        protected ReflectionMember(MemberInfo member)
        {
            Assumes.NotNull(member);

            _member = member;
        }

        public abstract bool CanRead
        {
            get;
        }
        
        public Type DeclaringType
        {
            get { return _member.DeclaringType; }
        }

        public override string Name
        {
            get { return _member.Name; }
        }

        public abstract bool RequiresInstance
        {
            get;
        }

        public MemberInfo UnderlyingMember
        {
            get { return _member; }
        }

        public abstract object GetValue(object instance);
    }
}
